package cn.fy.erupt;

import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import xyz.erupt.core.annotation.EruptScan;

@SpringBootApplication
@EntityScan
@EruptScan
public class FyEruptApplication {

	public static void main(String[] args) {
		ConfigurableApplicationContext run = SpringApplication.run(FyEruptApplication.class, args);
        ConfigurableEnvironment environment = run.getEnvironment();
		String port = environment.getProperty("local.server.port");
		try {
			System.setProperty("java.awt.headless", "false");
			Desktop.getDesktop().browse(new URI("http://localhost:"+port));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (URISyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
